package cn.kai.basic.config;

import cn.kai.basic.interceptor.LogionInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration // 配置类
public class LoginConfig implements WebMvcConfigurer {
    @Autowired
    private LogionInterceptor logionInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(logionInterceptor)
                .addPathPatterns("/**")
                .excludePathPatterns("/login/**") // 登录
                .excludePathPatterns("/register/**") // 用户注册
                .excludePathPatterns("/shop/settlement/**") // 店铺注册
                .excludePathPatterns("/fastDfs/**") // 上传图片
                .excludePathPatterns("/verifyCode/**"); // 验证码
    }
}
